home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / OBJECT_L.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.0 KB  |  66 lines

  1. package sub_arctic.lib;
  2.  
  3. /**
  4.  * This class is a convenient way to put arbitrary objects into a listbox and 
  5.  * have them displayed as strings. However, when you ask for the objects in
  6.  * the selected set or the contents of the listbox, you'll get the
  7.  * original objects back. <P>
  8.  *
  9.  * The object you supply is converted to a string by using toString().
  10.  *
  11.  * @author Ian Smith
  12.  */
  13. public class object_list_element extends text_list_element {
  14.   
  15.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  16.  
  17.   /**
  18.    * This is the object we are displayed.
  19.    */
  20.   protected Object _obj;
  21.  
  22.   /**
  23.    * Retrieve the object we are displaying.
  24.    */
  25.   public Object obj() { return _obj;}
  26.  
  27.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  28.  
  29.   /**
  30.    * Create a new object_list_element given an object. This object
  31.    * will be displayed in the listbox using its string name (toString().
  32.    * @param Object o the object to put in the listbox
  33.    */
  34.   public object_list_element(Object o) {
  35.     super(o.toString());
  36.     _obj=o;
  37.   }
  38.  
  39.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  40.  
  41.   /**
  42.    * Return the object you originally supplied when asked for it
  43.    * by the listbox.
  44.    * @return Object the object supplied at construction time
  45.    */
  46.   public Object convert_to_object() { return _obj;}
  47.  
  48.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  49. }
  50. /*=========================== COPYRIGHT NOTICE ===========================
  51.  
  52. This file is part of the subArctic user interface toolkit.
  53.  
  54. Copyright (c) 1996 Scott Hudson and Ian Smith
  55. All rights reserved.
  56.  
  57. The subArctic system is freely available for most uses under the terms
  58. and conditions described in 
  59.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  60. and appearing in full in the lib/interactor.java source file.
  61.  
  62. The current release and additional information about this software can be 
  63. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  64.  
  65. ========================================================================*/
  66.